<div class="row-fluid"><a id="comment"></a>
    <div class="title-cmt"><?php echo $titleDefinitions['vietbinhluan'];?></div>
    <div class="box-comment">
        <?php 
            $traloi = null;
            if(!empty($_GET['traloi'])){
                $traloi = '?traloi='.$_GET['traloi'];
            }
        ?>
        <?php echo $this->Form->create(null, array('url' => DOMAIN.'binh-luan/'.$id_post.'/'.$type_post.$traloi.'#comment', 'type' => 'post','enctype'=>'multipart/form-data', 'name' => 'adminForm', 'inputDefaults' => array('label' => false, 'div' => false, 'legend'=> false))); ?>
            <?php echo $this->Form->input('Cmt.content',array('type'=>'textarea','class'=>'ckeditor-mini'));?>
            <div class="clear-content"></div>
            <div class="text-right">
                <input type="submit" class="btn btn-small btn-primary" value="<?php echo lang('send_comment');?>"/>
                <input type="reset" class="btn btn-small" value="<?php echo lang('reset_comment');?>"/>
            </div>
            <div class="clear-content"></div>
            <?php echo $this->Session->flash(); ?>
        <?php echo $this->Form->end(); ?>
    </div>
    <div class="row-fluid">
        <div class="box-view-comment">
            <ul class="media-list">
                <?php
                    foreach($listcomt as $val){
                ?>
                <li class="media">
                    <a href="#" class="pull-left">
                        <img data-src="<?php echo DOMAIN;?>img/w64/h64/<?php echo $val['images'];?>" class="media-object" alt="avatar" src="<?php echo DOMAIN;?>img/w64/h64/<?php echo $val['images'];?>" />
                    </a>
                    <div class="media-body">
                        <h4 class="media-heading"><?php echo $val['fullname'];?> <span>Date <?php echo date('d-m-Y', strtotime($val['created'])); ?></span></h4>
                        <p class="content-comment"><?php echo $val['content'];?></p>
                        <p class="tra-loi-cmt"><a href="?traloi=<?php echo $val['id'];?>#comment" title="Trả lơi"><?php echo lang('tra_loi');?></a></p>
                        <!-- Nested media object -->
                        <?php 
                            foreach($val['list'] as $value){
                        ?>
                        <div class="media">
                            <a href="#" class="pull-left">
                                <img data-src="<?php echo DOMAIN;?>img/w64/h64/avatar.png" class="media-object" alt="avatar" src="<?php echo DOMAIN;?>img/w64/h64/avatar.png">
                            </a>
                            <div class="media-body">
                                <h4 class="media-heading"><?php if(!empty($value['User']['fullname'])) echo $value['User']['fullname'];?> <span>Date <?php echo date('d-m-Y', strtotime($value['Cmt']['created'])); ?></span></h4>
                                <?php echo $value['Cmt']['content'];?>
                            </div>
                        </div>
                        <?php }?>
                    </div>
                </li>
                <?php }?>
            </ul>
        </div><!--end box-view-comment-->
    </div>
</div>
<?php echo $this->Html->script('ckeditor/ckeditor'); ?>
<script type="text/javascript">
CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here. For example:
	config.language = 'vi';
	//config.uiColor = '#AADC6E';
	config.skin='kama';
	config.enterMode = CKEDITOR.ENTER_BR;
    config.height = 100;

	config.filebrowserBrowseUrl 		= '<?php echo DOMAIN;?>js/ckfinder/ckfinder.html';
	config.filebrowserImageBrowseUrl 	= '<?php echo DOMAIN;?>js/ckfinder/ckfinder.html?type=Images';
	config.filebrowserFlashBrowseUrl 	= '<?php echo DOMAIN;?>js/ckfinder/ckfinder.html?type=Flash';
};
</script>
<script type="text/javascript">
$('.ckeditor-mini').each(function(){
    CKEDITOR.replace($(this).attr('name'), {'toolbar': [
        { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [] },
    	{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline'] },
    	{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: ['Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl' ] },
        { name: 'links', items: [] },
    	{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
    	{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
    ] });
});
</script>